package graduation.project.body;

import java.util.ArrayList;

public class TestCases {
	
	private final String testSetID;
	private final String originEx;
	private final String model;
	private ArrayList<TestCase> testSet;
	private final String strategy;
	
	public TestCases(String originEx, String model, String strategy){
		if(strategy == null)
			this.strategy = "Nature";
		else
			this.strategy = strategy;
		this.model = model;
		this.originEx = originEx;
		testSetID = Integer.toString(originEx.hashCode()) + '_' + this.strategy + (int)(Math.random() * 1000);
	}
	public TestCases(String originEx, String testSetID, String model, String strategy){
		this.model = model;
		this.strategy = strategy;
		this.originEx = originEx;
		this.testSetID = testSetID;
	}
	
	public String getModel(){
		return model;
	}

	public ArrayList<TestCase> getTestSet() {
		return testSet;
	}

	public void setTestSet(ArrayList<TestCase> testSet) {
		this.testSet = testSet;
	}

	public String getTestSetID() {
		return testSetID;
	}

	public String getOriginEx() {
		return originEx;
	}
	
	public void addTestCases(TestCase tc){
		testSet.add(tc);
	}
	
	public void removeTestCases(TestCase tc){
		testSet.remove(tc);
	}
	
	public boolean equals(Object obj){
		if(!(obj instanceof TestCases))
			return false;
		if(obj == null)
			return false;
		
		TestCases ts = (TestCases)obj;
		if(ts.getTestSetID().equals(testSetID))
			return true;
		return false;
	}
	
	public String toString(){
		return "Test Cases ID: " + testSetID + ", origin expression is " + originEx + ".";
	}

}
